]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
popupMenu: Only allow one submenu to be open at a time
authorJasper St. Pierre <jstpierre@mecheye.net>
Tue, 11 Jun 2013 23:12:46 +0000 (19:12 -0400)
committerJasper St. Pierre <jstpierre@mecheye.net>
Mon, 15 Jul 2013 16:34:22 +0000 (12:34 -0400)
When the user opens another submenu, close the first one.

https://bugzilla.gnome.org/show_bug.cgi?id=702539

js/ui/popupMenu.js

index ce7f3cce3d6c8c0347f4b1026a868bc0a2c6df66..c2bc9962301ccb35f7134cfc26abf6602476ef0b 100644 (file)
@@ -1005,6 +1005,14 @@ const PopupMenu = new Lang.Class({
         this.actor.reactive = true;
 
         this._childMenus = [];
+        this._openedSubMenu = null;
+    },
+
+    _setOpenedSubMenu: function(submenu) {
+        if (this._openedSubMenu)
+            this._openedSubMenu.close(true);
+
+        this._openedSubMenu = submenu;
     },
 
     _boxGetPreferredWidth: function (actor, forHeight, alloc) {
@@ -1299,6 +1307,8 @@ const PopupSubMenuMenuItem = new Lang.Class({
             this.actor.add_style_pseudo_class('open');
         else
             this.actor.remove_style_pseudo_class('open');
+
+        this._getTopMenu()._setOpenedSubMenu(this.menu);
     },
 
     destroy: function() {